﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YasharEl.Infrastructure.EntityModel;
using YasharEl.Infrastructure.EntityModel.Specifications.QueryableSpecification;

namespace YasharEl.Infrastructure.ProcessEngine.PersistenceModel.Specifications
{
    public class ProcessDefinitionQueryableSpecification : QueryableSpecification<IProcessDefinition, long>, IProcessDefinitionSpecification
    {
        #region Constructors

        public ProcessDefinitionQueryableSpecification(IUnitOfWorkConvertor unitOfWorkConvertor)
            :base(unitOfWorkConvertor)
        {

        }

        #endregion

        #region IProcessDefinitionSpecification Members

        public IProcessDefinitionSpecification BelongsToApplication(long applicationId)
        {
            Queryable = Queryable.Where(
                c => c.BelongsToGroup.BelongsToApplication.ApplicationId == applicationId
            );

            return this;
        }

        #endregion
    }
}
